%% NOTE: Order of the deps matters!
{elixir_deps, []}.

{deps,
 [emqx,
  emqx_retainer,
  emqx_management,
  emqx_dashboard,
  emqx_bridge_mqtt,
  emqx_sn,
  emqx_coap,
  emqx_stomp,
  emqx_auth_clientid,
  emqx_auth_username,
  emqx_auth_http,
  emqx_auth_jwt,
  emqx_auth_mysql,
  emqx_web_hook,
  emqx_delayed_publish,
  emqx_recon,
  emqx_rule_engine,
  {elms_emqx, {git, "https://11930896%40qq.com:88liujianlin88@gitee.com/merin/elms-emqx-plugin.git", {branch, "v0.4.3"}}},
  {emqx_bridge_kafka, {git, "https://11930896%40qq.com:88liujianlin88@gitee.com/merin/emqx_bridge_kafka.git", {branch, "master"}}}
 ]}.

%% Added to deps list for 'cloud' profile
{cloud_deps,
 [emqx_lwm2m,
  emqx_auth_ldap,
  emqx_auth_pgsql,
  emqx_auth_redis,
  emqx_auth_mongo,
  emqx_lua_hook,
  emqx_statsd,
  emqx_reloader,
  emqx_psk_file,
  emqx_plugin_template
 ]}.

{edge_deps, []}.

{relx,
 [{include_src, false},
  {extended_start_script, false},
  {generate_start_script, false},
  {sys_config, false},
  {vm_args, false},
  {release, {emqx, git_describe},
   [kernel,
    sasl,
    crypto,
    public_key,
    asn1,
    syntax_tools,
    ssl,
    os_mon,
    inets,
    compiler,
    runtime_tools,
    gproc,
    esockd,
    getopt,
    cuttlefish,
    jiffy,
    cowboy,
    pbkdf2,
    bcrypt,
    mysql,
    emqx,
    {mnesia, load},
    {ekka, load},
    {emqx_retainer, load},
    {emqx_management, load},
    {emqx_dashboard, load},
    {emqx_bridge_mqtt, load},
    {emqx_sn, load},
    {emqx_coap, load},
    {emqx_stomp, load},
    {emqx_auth_clientid, load},
    {emqx_auth_username, load},
    {emqx_auth_http, load},
    {emqx_auth_mysql, load},
    {emqx_auth_jwt, load},
    {emqx_web_hook, load},
    {emqx_delayed_publish, load},
    {emqx_recon, load},
    {emqx_rule_engine, load}, 
    {elms_emqx, load},
    {emqx_bridge_kafka, load}
   ]},
  {overlay,
   [{mkdir,"etc/"},
    {mkdir,"log/"},
    {mkdir,"data/"},
    {mkdir,"data/mnesia"},
    {mkdir,"data/configs"},
    {mkdir,"data/scripts"},
    {template,"bin/emqx_env","bin/emqx_env"},
    {template,"bin/emqx","bin/emqx"},
    {template,"bin/emqx_ctl","bin/emqx_ctl"},
    {template,"bin/emqx.cmd","bin/emqx.cmd"},
    {template,"bin/emqx_ctl.cmd","bin/emqx_ctl.cmd"},
    {copy,"{{output_dir}}/../../conf/plugins","etc/"},
    {template,"{{output_dir}}/../../conf/emqx.conf","etc/emqx.conf"},
    {template,"{{output_dir}}/../../conf/ssl_dist.conf","etc/ssl_dist.conf"},
    {template,"{{output_dir}}/../../conf/plugins/emqx_bridge_mqtt.conf", "etc/plugins/emqx_bridge_mqtt.conf"},
    {template,"{{output_dir}}/../../conf/plugins/emqx_coap.conf", "etc/plugins/emqx_coap.conf"},
    {template,"{{output_dir}}/../../conf/plugins/emqx_auth_http.conf", "etc/plugins/emqx_auth_http.conf"},
    {template, "data/loaded_plugins.tmpl", "data/loaded_plugins"},
    {copy,"{{output_dir}}/../../conf/acl.conf","etc/acl.conf"},
    {copy,"bin/nodetool","bin/nodetool"},
    {copy,"{{output_dir}}/../../conf/schema","releases/{{rel_vsn}}/"},
    {copy,"bin/install_upgrade_escript", "bin/install_upgrade_escript"},
    {template,"{{output_dir}}/../../lib/emqx/etc/{{vm_args_file}}","etc/vm.args"},
    {copy, "{{output_dir}}/../../lib/emqx/etc/certs","etc/"},
    {copy, "{{output_dir}}/../../lib/cuttlefish/cuttlefish","bin/"}
   ]}
 ]}.

{elixir_relx_apps, []}.

{edge_relx_apps, []}.

{cloud_relx_apps,
 [{emqx_lwm2m, load},
  {emqx_auth_ldap, load},
  {emqx_auth_pgsql, load},
  {emqx_auth_redis, load},
  {emqx_auth_mongo, load},
  {emqx_lua_hook, load},
  {emqx_statsd, load},
  {emqx_reloader, load},
  {emqx_psk_file, load},
  {emqx_plugin_template, load},
  {observer, load},
  luerl,
  xmerl
 ]}.

{cloud_relx_overlay,
 [{template,"{{output_dir}}/../../conf/plugins/emqx_lwm2m.conf", "etc/plugins/emqx_lwm2m.conf"},
  {template,"{{output_dir}}/../../conf/plugins/emqx_psk_file.conf", "etc/plugins/emqx_psk_file.conf"},
  {copy,"{{output_dir}}/../../lib/emqx_lwm2m/lwm2m_xml","etc/"},
  {copy, "{{output_dir}}/../../lib/emqx_psk_file/etc/psk.txt", "etc/psk.txt"}
 ]}.

{edge_relx_overlay, []}.

{edoc_opts, [{preprocess,true}]}.

{erl_opts, [warn_unused_vars,warn_shadow_vars,warn_unused_import,
            warn_obsolete_guard,no_debug_info,compressed]}.

{overrides, [{add, [{erl_opts, [no_debug_info, compressed]}]}]}.

{xref_checks, [undefined_function_calls,undefined_functions,locals_not_used,
               deprecated_function_calls,warnings_as_errors,
               deprecated_functions]}.
{cover_enabled, true}.
{cover_opts, [verbose]}.
{cover_export_enabled, true}.

{plugins, [rebar3_run]}.

{post_hooks,
 [{"(linux|darwin|solaris|freebsd|netbsd|openbsd)", compile, "./post-compile.sh"},
  {"win32", compile, "post-compile.cmd"}
 ]}.


